from dna.Parameters import *
from dna.PolymorphismTables import PolymorphismTables
import dna.SiteFrequencySpectrum as sfs
import infiniteSitesTools as ist
import numpy.matlib as np

#test

NUM_OF_SIMULATIONS = 3
NUM_OF_CHROMOSOMES = 5

N = 1e4
MU = 1e-8
LENGTH = 25000
THETA = 4.0 * N * MU * LENGTH

N1 = 1e3
T1 = 5000

p = Population(NUM_OF_CHROMOSOMES, N, LENGTH, MU, 0.0)
print p
print

d = Demography(1e4)
#d.addEpoch(5e3, 5e3, 0.0)
#d.addEpoch(1.5e4, 5e4, 0.3)

pt = PolymorphismTables()
msOut = pt.runMS( p.getMSString(NUM_OF_SIMULATIONS) + d.getMSString() )
pt.readMS(None, msOut)
#pt.readMS('../../msOuts/out5_10.ms')
#
#print pt
#print

mySFS = sfs.SiteFrequencySpectrum(pt)
print mySFS
print

td = ist.TajimasD()
fld = ist.FulLiD()
flf = ist.FulLiF()

for s in mySFS:
	print td.calculate(s), fld.calculate(s), flf.calculate(s)
	

#ep = d.epochs[0]
#ep.setIterationParameters('growth', 0.1, 1.0)
#
#for epItr in ep:
#    print ep

